//
//  SmallView.m
//  i5db
//
//  Created by iMuse on 15-5-15.
//  Copyright (c) 2015年 mySelf. All rights reserved.
//

#import "SmallView.h"

@implementation SmallView
{
    UIImageView * imageView;
    UILabel     * textLabel;
}

- (id)init
{
    self = [super init];
    if (self)
    {
        [self initView];
    }
    return self;
}
-(void)updateConstraints
{
    [super updateConstraints];
    [imageView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:0];
    [imageView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:0];
    [imageView autoSetDimensionsToSize:CGSizeMake(12, 12)];
    
    [textLabel autoPinEdge:ALEdgeLeft toEdge:ALEdgeRight ofView:imageView withOffset:3];
    [textLabel autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:0];
    
}
-(void) initView
{
    imageView = [UIImageView newAutoLayoutView];
    [self addSubview:imageView];
    
    textLabel = [UILabel newAutoLayoutView];
    textLabel.text = @"0";
    textLabel.font = [UIFont systemFontOfSize:10];
    [self addSubview:textLabel];
    
}

-(void)settingAttrView:(UIImage*)_image text:(NSString*)_text color:(UIColor*)_color
{
    imageView.image = _image;
    textLabel.text = _text;
    if (_color)
    {
        textLabel.textColor = _color;
    }
}


@end
